package com.ost.kautilya.utils.metrics;

import com.ost.kautilya.utils.Metric.DataType;

public class Maximum extends AbstractMetric<Number> {
	private static final long serialVersionUID = 1L;
	private double max;

	public Maximum(DataType dt) {
		super(dt);
		max = Double.NEGATIVE_INFINITY;
	}

	@Override
	public void push(long index, Number number) {
		max = max > number.doubleValue() ? max : number.doubleValue();
	}

	@Override
	protected double asDouble() {
		return max;
	}
	
	@Override
	public void reset() {
		max = Double.NEGATIVE_INFINITY;
	}

}
